﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using WindowsLive.Writer.Api;

namespace InsertEmoticonPlugin
{
    [WriterPlugin("22dd3079-6de8-41c7-b5d4-2fe55af27b8f", "Insert Live Spaces Emoticon",
        HasEditableOptions = false,
        PublisherUrl = "http://scottisafool.spaces.live.com/",
        Description = "Gives the user an option to insert a Windows Live Spaces emoticon",
        ImagePath = "smile.gif"
        )]
    [InsertableContentSource("A Spaces Emoticon")]
    public class InsertEmo : ContentSource
    {
        
        public override DialogResult CreateContent(IWin32Window dialogOwner, ref string newContent)
        {
            if (!string.IsNullOrEmpty(newContent))
            {
                ScottIsAFool scott = new ScottIsAFool();
                newContent = scott.Emotify(newContent);
                return DialogResult.OK;
            }
            else
            {
                using (frmAddEmoticon newEmo = new frmAddEmoticon())
                {
                    DialogResult result = newEmo.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        newContent = String.Format(newEmo.text);
                    }
                    return result;
                }
            }
        }
    }
}
